//*************************************************************************//
//*           _____   ____________            ______               __     *//
//*          / /__ \ / ____/ ____/           / ____/___  _________/ /     *//
//*     __  / /__/ // __/ / __/    ______   / /_  / __ \/ ___/ __  /      *//
//*    / /_/ // __// /___/ /___   /_____/  / __/ / /_/ / /  / /_/ /       *//
//*    \____//____/_____/_____/           /_/    \____/_/   \__,_/        *//
//*                                                                       *//
//*     Copyright (c) 2006 Ford Argentina. All Rights Reserved.           *//
//*                                                                       *//
//*************************************************************************//

package ar.com.ford.it.webengine.filter;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

/**
 * IEFilter <br>
 * Filtro que evita el acceso a la aplicacion desde un navegador que no sea IE
 * 
 * @author Aji
 */
public class IEFilter implements Filter {

    //private FilterConfig filterConfig = null;

	/**
	 * @see javax.servlet.Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
	 */
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest httprequest = (HttpServletRequest) request;
        String browserDet = httprequest.getHeader("User-Agent").toLowerCase();

/*        if ( browserDet.indexOf("msie") == -1 )  {
            PrintWriter out = response.getWriter();
            out.println("<html><head></head><body>");
            out.println("<h1>Ford Argentina S&#46;C&#46;A&#46;</h1>");
            out.println("<h2>Su navegador no es 100&#37; compatible con la aplicaci&oacute;n</h2>");
            out.println("<h3>Utilice M&#36; Internet Explorer</h3>");
			out.println("</body></html>");
            out.flush();
            return;
        }
*/    
        chain.doFilter(request, response);
    }


	/**
	 * @see javax.servlet.Filter#destroy()
	 */
    public void destroy() {
    }


	/**
	 * @see javax.servlet.Filter#init(FilterConfig)
	 */
    public void init(FilterConfig filterConfig) {
		//this.filterConfig = filterConfig;
    }


}
